class MyRangeIterator:
    def __init__(self, start=0, end=0):
        self.start = start
        self.end = end

    def __next__(self):
        if self.start < self.end:
            item = self.start
            self.start += 1
            return item

        else:
            raise StopIteration()


class MyRange:
    def __init__(self, start, end):
        self.start = start
        self.end = end

    def __iter__(self):
        return MyRangeIterator(self.start, self.end)


for element in MyRange(0, 5):
    print(element)
